|
|
Assignment No. 1 CS201 – Introduction to Programming |
Total Marks: 20 Due Date: 9-12-2021 |
|
|
Instructions Please read the following instructions
carefully before submitting assignment: It should be clear that your assignment will
not get any credit if: o
Assignment is submitted after due date. o
Submitted assignment does not open or file is
corrupt. o
Assignment is copied (From
internet/students). Recommended tool to develop Assignment -
Dev C++ Objectives: To enable students to
understand and practice the concepts of:
Assignment Submission Instructions You have to submit only.cpp file on the assignments interface of CS201
from your LMS account. Assignment submitted in any other format will be scaled with zero mark. So, check your solution
file format before submission. For any query related to
assignment, please contact cs201@vu.edu.pk.
Lectures: 1 to 6 |
|||
|
Assignment |
|
||
|
Write a C++ program that performs the following tasks: 1-Print your name and VU id. 2-Add last 3 digit of your VU id. 3-Display the result of sum on screen. 4-Use if-else statement :: a)
If sum is odd then print your name
using while loop. Number of iterations of while loop should be equal to the
sum. b)
If sum is even then print your VU id
using while loop. Number of iterations of while loop should be equal to the
sum. [use remainder operator on sum value to
determine the odd and even value for if condition] For example, suppose the student id is BC123456781. Then
by adding last 3 digits of vu id, we get 16 which is an even number. In this
case, program should print your VU ID for 16 times using while loop. Sample
screen shot::
Sample
screen shot::
|
|
NOTE:
Student’s name and id are supposed values (not real) in above example.
You will print your own VU Id and Name otherwise you will get zero marks. |



0 Comments